Test your integration with test Ads
To help you test your integration during development, you can enable test ads via the SDK. This is useful to quickly test how your app flow works when showing ads and listening to the different callbacks.
Once you finish testing your integration remember to run your app on a physical device.
Request Test Ads
When testing you should request ads by setting the test flag to true when initializing XMediator and when creating ad instances. We use this flag to ask the underlying networks to provide us with test ads when possible.
Some mediation services (or their underlying networks) may not support this flag and might provide other means to test their integration, so make sure to always check their documentation for any additional steps.
We do provide test Placement Ids to enable a quick way to test the integration.
Test Placement Ids
- Android
- iOS
Placement | MAX Mediation | LevelPlay Mediation | AdMob Mediation |
---|---|---|---|
App key | V148L42DB1 | V148L42DB8 | V148L48DBJ |
Banner | V142DR9L2247MG | V142DR2LD0QYR1 | V14JHR4Z2LKRFYNP |
Interstitial | V142DRJLE1G5XX | V142DR1L7WJN07 | V14JHR28KLVMZGXJ |
App Open | V14JHR4ZKL86RTC2 | - | V14JHR283LMV0WYT |
Rewarded | V142DR4LW2MT4B | V142DR8L1DP5ND | V14JHR282L889BY3 |
Placement | MAX Mediation | LevelPlay Mediation | AdMob Mediation |
---|---|---|---|
App key | V148L42DRG | V148L42DR3 | V148L48DB9 |
Banner | V142XB3LRNZCM7 | V142YBZL36TNH7 | V14JHR4VKLPYKX70 |
Interstitial | V142XBGL601BCD | V142YB3L1J9DKT | V14JHR4V2LCPBMMY |
App Open | V14JHR48HLHAQ304 | - | V14JHR4VHLG8A741 |
Rewarded | V142DRKLYD2CVX | V142YBGLYF22ST | V14JHR4V3L78QZQ2 |
Currently, these placements are only supported for these ad networks: Google Ads, AppLovin and Unity Ads.
Remember to replace these test placements with your own placements and always set the test and verbose flags to false in a production environment
Enable test mode
Set the test flag to true to see test ads when available.
auto* sdk = x3mads::XMediatorAds::getInstance();
bool shouldRequestTestAds = true; // e.g. set true for debug builds
x3mads::InitSettings settings;
settings.test = shouldRequestTestAds;
x3mads::UserProperties user;
user.userId = x3mads::Optional<std::string>("<your-user-id>");
settings.userProperties = x3mads::Optional<x3mads::UserProperties>(user);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
auto appKey = "V148L42DRG";
auto bannerPlacementId = "V142XB3LRNZCM7";
auto interstitialPlacementId = "V142XBGL601BCD";
auto rewardedPlacementId = "V142DRKLYD2CVX";
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
auto appKey = "V148L42DB1";
auto bannerPlacementId = "V142DR9L2247MG";
auto interstitialPlacementId = "V142DRJLE1G5XX";
auto rewardedPlacementId = "V142DR4LW2MT4B";
#endif
sdk->startWith(appKey, settings, [=](const x3mads::InitResult&) {
sdk->banner->addListener(this);
sdk->interstitial->addListener(this);
sdk->rewarded->addListener(this);
sdk->banner->create(bannerPlacementId, x3mads::BannerSize::PHONE);
sdk->interstitial->load(interstitialPlacementId);
sdk->rewarded->load(rewardedPlacementId);
});
Enable verbose logging
Setting the verbose flag to true will output extra logging information to Logcat on Android and to the standard output on iOS.
auto* sdk = x3mads::XMediatorAds::getInstance();
x3mads::InitSettings settings;
settings.verbose = true;
x3mads::UserProperties user;
user.userId = x3mads::Optional<std::string>("<your-user-id>");
settings.userProperties = x3mads::Optional<x3mads::UserProperties>(user);
sdk->startWith("<your-app-key>", settings, [](const x3mads::InitResult&){});